﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace System
{
    public class ZSecurity
    {
        public static string EncryptPass(string password, string PasswordFormat)
        {
            string EncryptPassword = null;
            if ("SHA1".Equals(PasswordFormat))
            {
                EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
            }
            else if ("MD5".Equals(PasswordFormat))
            {
                EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            }
            else
            {
                EncryptPassword = password;
            }
            return EncryptPassword;
        }
    }
}
